;

        function param_read(){
            if(document.getElementById("slave_addr").value.length == 0) {window.alert("请输入站号！"); return;}
            if(document.getElementById("param_num").value.length == 0) {window.alert("请输入参数号！"); return;}   
            var slave_addr=document.getElementById("slave_addr").value;
            var param_num=document.getElementById("param_num").value;
            AJAX_func("read","slave_addr="+slave_addr+",param_num="+param_num+";", document.getElementById("param_value"));
            for(x in d700_json){
                if(d700_json[x].param_num == param_num){
                    document.getElementById("name").value = d700_json[x].name;
                    document.getElementById("param_range").value = d700_json[x].range;
                    document.getElementById("tips").innerHTML = "<p>初始值："+d700_json[x].init_value+"</p>"+"<p>注意：实际值等于显示当前值 * "+d700_json[x].step+"</p>";
                }else continue;
            }
        }

        function change_ensure(){
            if(document.getElementById("slave_addr").value.length == 0) {window.alert("请输入站号！"); return;}
            if(document.getElementById("param_num").value.length == 0) {window.alert("请输入参数号！"); return;} 
            if(document.getElementById("input_value").value.length == 0) {window.alert("请输入目标值！");return;}
            var input_value=document.getElementById("input_value").value;
            var slave_addr=document.getElementById("slave_addr").value;
            var param_num=document.getElementById("param_num").value;
            AJAX_func("set", "slave_addr="+slave_addr+",param_num="+param_num+",input_value="+input_value+";", document.getElementById("param_value"));
             for(x in d700_json){
                if(d700_json[x].param_num == param_num){
                    document.getElementById("name").value = d700_json[x].name;
                    document.getElementById("param_range").value = d700_json[x].range;
                    document.getElementById("tips").value = "初始值："+d700_json[x].init_value+"\n"+"实际值等于显示的值*"+d700_json[x].step;
                }else continue;
            }
        }
        
        function AJAX_func(url,send_mes,x){
            var xhttp = new XMLHttpRequest();
            xhttp.onreadystatechange = function() {
                if (xhttp.readyState == 4 && xhttp.status == 200) {                    
                        x.value = xhttp.responseText;
                } 
            }
            xhttp.open("POST", url, true);
            xhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
            xhttp.send(send_mes);

        }      
     
  </script>
</body>
</html>